package cn.gson.boot.model.dao;

import cn.gson.boot.model.pojos.Kefu;
import cn.gson.boot.model.pojos.Weixiugongdan;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import javax.transaction.Transactional;
import java.math.BigDecimal;

public interface WeiXiuGongDanDao extends CrudRepository<Weixiugongdan,Integer> {
    //移除维修工单（逻辑删除）
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update weixiugongdan set gd_ys = 0 where gd_id=?1")
    public void yichuWXGD(Integer gdId);


    //修改工单的进度
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update weixiugongdan set gd_sh = ?1 where gd_id=?2")
    public void updateGdJingDu(String gdJd,Integer gdId);


    //修改工单的状态
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update weixiugongdan set gd_zhuangtai = ?1 where gd_id=?2")
    public void updateGdZhuangTai(String zt,Integer gdId);

    //修改工单的不维修
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update weixiugongdan set sfwx = 3 where gd_id=?1")
    public void updateGdbuWeixiu(Integer gdId);

    //修改工单的已收款
    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "update weixiugongdan set weixiu_yishoumoney = ?1 where gd_id=?2")
    public void updateWXyiShouKuang(BigDecimal yishoukuang, Integer gdId);
}
